<template>
	<view>
		<zmm-watermark :watermark="userStore.watermark" v-if="userStore.watermark"></zmm-watermark>
		<view class="content detail">
			<!--营销单页-->
			<view class="detail-item">
				<uni-section title="营销单页信息" type="line"></uni-section>
				<view class="detail-content">
					<!-- <view class="detail-text">ID：<text>{{info.id}}</text></view> -->
					<view class="detail-text">按钮名字：<text>{{info.name}}</text></view>
					<view class="detail-text">
						链接地址：
						<text>{{info.url}}</text>
						<text class="detail-text-copy" @click="copyText(info.url)">复制</text>
					</view>
					<view class="main-flex detail-text detail-flex-start">
						按钮图片：
						<view class="detail-text_r">
							<up-image width="120rpx" height="120rpx" @click.stop="previewImg(info.buttonImg)" :src="info.buttonImg" :lazy-load="true"></up-image>
						</view>
					</view>
					<view class="main-flex detail-text detail-flex-start">
						内容：
						<view class="detail-text_r">
							<up-parse :content="info.content"></up-parse>
						</view>
					</view>
				</view>
			</view>
			
		</view>
	</view>
</template>

<script setup>
import { onLoad } from '@dcloudio/uni-app';
import { computed, onMounted, ref } from 'vue';
import { tab, auth, modal } from "@/plugins"
import { getTitle } from "@/utils/getter"
import { checkPermi, checkRole, checkOnlyPermi, checkOnlyRole } from "@/utils/permission"
import { spreadSinglePageDetail } from "@/api/erp_api/coupon"
import { copyText, arrText, previewImg } from '@/utils/ty.js';
import useUserStore from '@/store/modules/user'

	const userStore = useUserStore()
	onLoad(async (option) => {
		if (option.id) {
			id.value = option.id
			getDetail()
		}
	})
	
	// 数据查询
	const id = ref('')
	const info = ref({})
	const isLoading = ref(false)
	
	const getDetail = () => {
		const params = {
			id: id.value
		}
		isLoading.value = true
		uni.showLoading({
			title: '数据加载中...'
		})
		spreadSinglePageDetail(params).then(res => {
			info.value = res.data || {}
			isLoading.value = false
			uni.hideLoading()
    }).catch(() => {
			isLoading.value = false
			uni.hideLoading()
		})
	}
	
</script>

<style scoped lang="scss">
</style>
